//
//  Helper.h
//  nonghubao
//
//  Created by chongqing642 on 13-1-26.
//  Copyright (c) 2013年 mypocketbaby. All rights reserved.
//



#import <Foundation/Foundation.h>
#import "Config.h"
#import "MBProgressHUD.h"
#import "APService.h"

@class JMFBase;

@interface Helper : NSObject
{

}


// 按钮类型定义
typedef NS_ENUM(NSInteger, ButtonStyle) {
    ButtonStyleNavigationReturn,
    ButtonStyleNavigationCancel,
    ButtonStyleNavigationCircleList,
    ButtonStyleNavigationWriteMessage,
    ButtonStyleNavigationAdd,
    ButtonStyleNavigationSave,
    ButtonStyleNavigationDone,
    ButtonStyleNavigationInvite,
    ButtonStyleNavigationEdit,
    ButtonStyleNavigationManage,
    ButtonStyleNavigationClear,
    ButtonStyleNavigationExitManage,
    ButtonStyleNavigationComfirm,
    ButtonStyleNavigationPost, 
    ButtonStyleNavigationSend,
    ButtonStyleNavigationMore,
    ButtonStyleNavigationDeleteDynamic
};

// 返回一个UIButton子类的按钮。按钮类型由ButtonStyle决定
+ (UIButton *)buttonWithStyle:(ButtonStyle)style;

// 将日期转化为字符串
+ (NSString *)stringWithDate:(NSDate *)date;

// 将字符串转化为日期
+ (NSDate *)dateWithString:(NSString *)string;

+ (NSString *)localizeDateString:(NSString *)dateString;

// 将图片的Width和Height按比例压缩
+ (UIImage *)resizeImage:(UIImage *)image forStyle:(PictureStyle)style;

// 压缩图片的StoreSize
+ (NSData *)compressImageData:(UIImage *)image withStyle:(PictureStyle)style;

// 按一个样式，计算图片被改变后的长宽
+ (CGSize)sizeOfImage:(UIImage *)image forStyle:(PictureStyle)style;

//将图片压缩成合适的尺寸以适应不同的分享平台的要求
+ (UIImage *)imageSuitable:(UIImage *)image;

// 测试一个字符串，是否为含有2个小数点的数字
+ (BOOL)testNumberWithString:(NSString *)string;

// 使用年月日形式格式化日期时间字符串
+ (NSString *)formatDateString:(NSString *)dateString;

// 简单处理一个JMF的状态
+ (void)easyShowJMFStatus:(JMFBase *)jmf;

// 立即显示一个提示信息
+ (void)showAlertWithTitle:(NSString *)title andMessage:(NSString *)message;

// 显示一个UTF8编码的字符串
+ (void)showUTF8String:(NSString *)string;

// 获取一个固定样式的UITextField
+ (UITextField *)textField:(CGRect)frame byPlaceholder:(NSString *)placeholder;

// 将用户的基本信息放入全局中
+ (void)setUserDefaultsWithID:(NSString *)accountID andToken:(NSString *)token andName:(NSString *)name;

// 将一个UINavigationController设置成固定样式
+ (void)navigationControllerCommonStyle:(UINavigationController *)controller;

// 计算一个Label
// 根据名字拼音查询联系人
+ (NSMutableArray *)filterAddressBook:(NSArray *)localAddressBook withString:(NSString *)string;

// 从通讯录中查询联系人(查询规则是 忽略大小写 和 模糊查询)
+ (BOOL)checkName:(NSString *)name includeString:(NSString *)string;

// 显示一个消息view，马上又消失
+ (void)showAllTextDialog:(NSString *)message inView:(UIView *)view;
// 在window上显示一个消息view，指定时间内又消失
+ (void)showAllTextDialog:(NSString *)message inSeconds:(float)seconds;

// 注销JPush
+ (void)logout;

+ (BOOL)validateMobile:(NSString *)mobile;

+ (UIView *)blankViewWithStauts:(NSString *)stauts;

+ (void)saveRegionDataToPlist:(NSArray *)regionData withName:(NSString *)name andStandard:(BOOL)standard;

//在添加好友的时候，缓存要添加的圈子信息
+ (void)cacheCircleWithIds:(NSMutableArray *)circleIds andNames:(NSMutableArray *)circleNames;

//清楚缓存的圈子信息
+ (void)clearCircleCache;

+ (NSMutableArray *)filterFriendsArray:(NSArray *)friends withString:(NSString *)string;

//用base64加密电话号码
+ (NSString *)encryptPhoneNumber:(NSString *)phone;

//用base64解密电话号码
+ (NSString *)decryptCiphertext:(NSString *)ciphertext;

+ (NSString *)realnameWithPerson:(NSMutableDictionary *)person;

//根据NSUserDefault的phoneBookSynchState判断，是否需要向服务器传递通讯录
+ (void)syncPhoneBook;

//获取通讯录
+ (NSArray *)loadContacts;

+ (NSString *)cleanPhone:(NSString *)phone;

+ (UINavigationController *)umfeedBackViewController;

+ (NSMutableArray *)replaceDictionaryToCollageInResponseData:(NSArray *)collageArray;

+ (void)saveMobile:(NSString *)mobile;
@end
